/**
 * task.js-
 */
import request from '../request'
class task {
  constructor() {
    this._defaultHeader = {
      'data-tupe': 'application/json'
    }
    this._request = new request
    this._request.setErrorHandler(this.errorHander)
  }

  /**
   * 统一的异常处理方法
   */
  errorHander(res) {
    console.error(res)
  }


  /**
   * 查询商品类型
   */
  getGoodsType(data) {
    const app = getApp()
    return this._request.getRequest(app.globalData._baseUrl + 'sys/goods-type/get-all', data).then(res => res.data)
  }
  /**
   * 查询商品详情
   */
  getOrderInfo(data) {
    const app = getApp()
    return this._request.getRequest(app.globalData._baseUrl + 'sys/order/task/get-order-info', data).then(res => res.data)
  }

  goods(data) {
    const app = getApp()
    return this._request.getRequest(app.globalData._baseUrl + 'home/home-page/goods?placementPointId=' + data, data).then(res => res.data)
  }

  shopCart(data) {
    const app = getApp()
    return this._request.getRequest(app.globalData._baseUrl + 'sys/home-page/goods/shop-cart?productId=' + data, data).then(res => res.data)
  }



  /**
 * 删除录音
 */
  deleteRecord(data) {
    const app = getApp()
    return this._request.postRequest(app.globalData._baseUrl + 'home/goods-sound-recording/delete', data).then(res => res.data)
  }
}
export default task